package com.ctrl.riveradministrator.mvp.presenter;

import android.util.Log;

import com.ctrl.riveradministrator.base.BaseObserver;
import com.ctrl.riveradministrator.base.BasePresenter;
import com.ctrl.riveradministrator.mvp.model.Bulletin;
import com.ctrl.riveradministrator.mvp.model.ToDo;
import com.ctrl.riveradministrator.mvp.view.activity.bulletin.BulletinView;
import com.ctrl.riveradministrator.mvp.view.activity.to_do_list.ToDoView;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

public class ToDoPresenter extends BasePresenter<ToDoView> {

    public ToDoPresenter(ToDoView baseView) {
        super(baseView);
    }

    /**
     * 待办事项
     *
     * @param userId 用户ID
     */
    public void getToDoList(String userId) {
        Map<String, String> map = new HashMap<>();
        map.put("userId", userId);
        attachView(apiService.getToDoList(map), new BaseObserver<ToDo>(getBaseView()) {
            @Override
            public void onSuccess(ToDo model) {
                Log.d("onSuccess",":");
            }

            @Override
            public void onSuccess(List<ToDo> model) {
                getBaseView().showMessage(model);
            }

            @Override
            public void onFailed(String msg) {
                Log.d("onFailed",":"+msg);
            }

        });
    }
}
